//
//  BaseDetailViewController.m
//  UGoods
//
//  Created by dllo on 16/1/18.
//  Copyright © 2016年 蓝鸥科技.李贺. All rights reserved.
//

#import "BaseDetailViewController.h"
#import "NightMode.h"
#import "ConstantsDefine.h"
@interface BaseDetailViewController ()

@end

@implementation BaseDetailViewController

- (void)dealloc
{
    // dealloc移除观察着
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        /* 隐藏底部tabBar */
        self.hidesBottomBarWhenPushed = YES;
        
//        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"iconfont-fanhuimohuan-2"] style:UIBarButtonItemStylePlain target:self action:@selector(handleBack:)];
        [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];

        
    }
    return self;
}

//- (void)handleBack:(UIBarButtonItem *)leftaBar {
//    [self.navigationController popViewControllerAnimated:YES];
//}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    if ([NightMode nightModeSharedInstance].isNight) {
        [self setNightDayModel];
    } else {
        [self setLightDayModel];
    }
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setLightDayModel) name:@"day" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setNightDayModel) name:@"night" object:nil];
}

- (void)setLightDayModel {
    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)setNightDayModel {
    self.view.backgroundColor = [UIColor blackColor];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
